package main

import (
	"time"
	"fmt"
	"sync"
)


func main(){
	//定义互斥锁
	m := new (sync.Mutex)

	for i:=0;i<10;i++{
		go func(i int){
			//加锁
			m.Lock()
			fmt.Println(i,"start")
			time.Sleep(time.Second)
			fmt.Println(i,"end")
			//解锁
			m.Unlock()
		}(i)
	}

	 j := 0
	for i := 0;i<5;i++ {
		go func(i int){
			j++
			fmt.Println(j)
		}(5)
	}

	var input string
	fmt.Scanln(&input)

}
